/*******************************************************************************
 * File Name: GPS_UBLOX.h
 *
 * Version: 1.0
 *
 * Description:
 *  This is a header file for the GPS UBLOX protocol library
 *
 * Created on: Feb 10, 2014
 *     Author: Petro Ksondzyk
 *
 * Notes:
 *  The source code is based on the AP GPS library and MultiWii 2.3 Code
 *
 ********************************************************************************
 * Copyright (2014)
 ********************************************************************************
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *******************************************************************************/

#ifndef GPS_UBLOX_H_
#define GPS_UBLOX_H_

/********************************************************************************/
/* Constants Definition                                                         */
/********************************************************************************/
enum ubs_protocol_bytes {
    PREAMBLE1 = 0xb5,
    PREAMBLE2 = 0x62,
    CLASS_NAV = 0x01,
    CLASS_ACK = 0x05,
    CLASS_CFG = 0x06,
    MSG_ACK_NACK = 0x00,
    MSG_ACK_ACK = 0x01,
    MSG_POSLLH = 0x2,
    MSG_STATUS = 0x3,
    MSG_SOL = 0x6,
    MSG_VELNED = 0x12,
    MSG_CFG_PRT = 0x00,
    MSG_CFG_RATE = 0x08,
    MSG_CFG_SET_RATE = 0x01,
    MSG_CFG_NAV_SETTINGS = 0x24
};

enum ubs_nav_fix_type {
    FIX_NONE = 0,
    FIX_DEAD_RECKONING = 1,
    FIX_2D = 2,
    FIX_3D = 3,
    FIX_GPS_DEAD_RECKONING = 4,
    FIX_TIME = 5
};

enum ubx_nav_status_bits {
    NAV_STATUS_FIX_VALID = 1
};


/********************************************************************************/
/* Exported Variables Declaration                                               */
/********************************************************************************/

/********************************************************************************/
/* Exported Functions Prototypes                                                */
/********************************************************************************/
extern void GPS_UBX_Init(void);
extern bool GPS_UBX_GetNewFrame(void);


#endif /* GPS_UBLOX_H_ */
